const state = {
  value: 0,
  show: false,
};
const mutations = {
  SET_VALUE: (state, val) => {
    state.value = val;
  },
  SET_SHOW: (state, val) => {
    state.show = val;
  },
};
const actions = {
  setValue: ({ commit }, val) => {
    return new Promise((resolve) => {
      if (val >= 100) {
        commit("SET_SHOW", false);
        commit("SET_VALUE", 0);
        resolve(null);
        return;
      }
      commit("SET_SHOW", true);
      commit("SET_VALUE", val);
    });
  },
};
export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
